package com.qiwenshare.file.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.qiwenshare.file.domain.SysRole;
import com.qiwenshare.file.domain.UserFile;
import com.qiwenshare.file.domain.user.Role;
import com.qiwenshare.file.domain.user.UserBean;
import com.qiwenshare.file.domain.user.UserRole;
import com.qiwenshare.file.vo.file.FileListVO;
import com.qiwenshare.file.vo.user.UserLoginVo;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface UserMapper extends BaseMapper<UserBean> {
    int insertUser(UserBean userBean);

    int insertUserRole(@Param("userId") String userId, @Param("roleId") long roleId);

    List<Role>  selectRoleListByUserId(@Param("userId") String userId);

    String selectSaltByTelephone(@Param("telephone") String telephone);
    String selectSaltByLoginAccount(@Param("loginAccount") String loginAccount);

    UserBean selectUserByTelephoneAndPassword(@Param("telephone") String telephone, @Param("password") String password);
    UserBean selectUserByLoginAccountAndPassword(@Param("loginAccount") String loginAccount, @Param("password") String password);

    IPage<UserLoginVo> selectPageVo(Page<?> page, @Param("userBean") UserBean userBean);

    /**
     * 批量新增数据（MyBatis原生foreach方法）
     *
     * @param entities List<Role> 实例对象列表
     * @return 影响行数
     */
    int insertBatch(@Param("entities") List<UserRole> entities);

    int deleteUserRole(@Param("userId") String userId);
    int deleteUserRoleByRoleId(@Param("roleId") Long roleId);

    List<UserBean> getEmployeeDepartmentManager(@Param("userId") String userId);

    List<UserBean> getArchiveDepartmentManager(@Param("archiveId") String archiveId);
    List<UserBean> getCeo();
}
